lib/bootconfig-parser: Write BLS fragment fields in a deterministic order
authorJavier Martinez Canillas <javierm@redhat.com>
Tue, 27 Aug 2019 00:12:29 +0000 (02:12 +0200)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 29 Aug 2019 12:58:43 +0000 (12:58 +0000)
commit2ca2b88f51c3131c3aa2322fe26bae2cee7e76fa
treeed2ce1d185f7fb65825beaa89c7803ee3f60b02b
parentf82f825fed8253b24eeb9c2d5447089348993862
lib/bootconfig-parser: Write BLS fragment fields in a deterministic order

Currently the BLS fragments fields write is non-determinisitc. The order
of the fields will depend on how the iterator of the options GHashTable
iterates over the key/value pairs.

But some bootloaders expect the fields to be written in a certain order.
For example the zipl bootloader (used in the s390x architecture) fails to
parse BLS files if the first field is not the 'title' field, since that's
used to name the zipl boot sections that are created from the BLS files.

Write the fields in a deterministic order, following what is used in the
example file of the BootLoaderspec document:

https://systemd.io/BOOT_LOADER_SPECIFICATION

Related: https://github.com/ostreedev/ostree/issues/1888

Closes: #1904
Approved by: cgwalters
src/libostree/ostree-bootconfig-parser.c